'use strict';

const Controller = require('egg').Controller;
const { ObjectId } = require("mongodb")
class DoDeleteController extends Controller {
    async index() {
        const { ctx } = this;
        var { _id } = ctx.query;
        var db = this.app.mongodb;
        const collection = await db.collection('member');
        var dele = await collection.deleteOne({ _id: ObjectId(_id) });
        console.log(dele);
        await ctx.redirect("/home")
    }
}

module.exports = DoDeleteController;
